Skip to content

Fix AttributeError when using generic SerializableType subclass#275

Merged
Fatal1ty merged 1 commit intoFatal1ty:masterfrom
ponyville:michi/issue-274
Jan 7, 2025
Merged

Fix AttributeError when using generic SerializableType subclass#275
Fatal1ty merged 1 commit intoFatal1ty:masterfrom
ponyville:michi/issue-274

Conversation

@Feuermurmel
Copy link
Copy Markdown
Contributor

@Feuermurmel Feuermurmel commented Jan 7, 2025

When using PEP 695 syntax to create a generic class, some private attributes are set up by the runtime in __init_subclass__(). Those attributes are needed when specializing the generic class.

SerializableType did not call super().__init_subclass__() and thus those attributes were missing, leading to an AttributeError.

Fixes #274

@Feuermurmel Feuermurmel changed the title Fix #274 Fix AttributeError when using generic SerializableType subclass Jan 7, 2025
When using PEP 695 syntax to create a generic class, some
private attributes are set up by the runtime in __init_subclass__().
Those attributes are needed when specializing the generic class.

SerializableType did not call super().__init_subclass__() and
thus those attributes were missing, leading to an AttributeError.
@Fatal1ty Fatal1ty merged commit 68fb7d2 into Fatal1ty:master Jan 7, 2025
@Fatal1ty
Copy link
Copy Markdown
Owner

Fatal1ty commented Jan 8, 2025

Looks good, thank you for your contribution!

@Feuermurmel
Copy link
Copy Markdown
Contributor Author

Sure! 😊 Thanks for acting on it so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError when using PEP 695 syntax SerializableType subclass

2 participants